package com.zjdiepu.www.commpent.mapper.dz;

import javax.annotation.Resource;

import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.status.ApplyDiviStatus;
import com.zjdiepu.www.base.enums.status.HzicbcApplyDiviStatus;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.icbc.dto.DzApplyDivi;
import com.zjdiepu.www.util.CachedEnums;

/**
 * 申请分期
 * 类描述:申请分期 <br/>     
 * 项目名称:diepu-parent-biz <br/> 
 * 类名称:DzApplyDiviVoMapper <br/>     
 * 创建人:xiongxiaotun <br/> 
 * 创建时间:2017年11月27日 上午11:14:49  <br/>   
 * 修改人:xiongxiaotun <br/> 
 * 修改时间: 2017年11月27日 上午11:14:49   <br/>  
 * 修改备注:   <br/> 
 * @version V1.0   <br/>
 */
@Component
public class DzApplyDiviVoMapper extends BaseMapper<DzApplyDivi> {
	@Resource
	private RedisObjectClient redisObjectClient;
	
	@Override
	public void mapper(RedisConnection redisConnection, DzApplyDivi m) {
		if(null == m) {
			return;
		}
		String feeMode = m.getFeeMode();
		SimpleDataDictionary simpleDataDictionary6 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),feeMode, DataDicType.HZICBC_FEE_MODE.getCode());
		m.setFeeModeDisplay(simpleDataDictionary6 == null ? "" : simpleDataDictionary6.getName());
		
		String tiexiFlag = m.getTiexiFlag();
		SimpleDataDictionary simpleDataDictionary7 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),tiexiFlag, DataDicType.HZICBC_TIEXI_FLAG.getCode());
		m.setTiexiFlagDisplay(simpleDataDictionary7 == null ? "" : simpleDataDictionary7.getName());
		
		Integer applyDiviStatus = m.getApplyDiviStatus();
		m.setApplyDiviStatusDisplay((String)CachedEnums.getValue(applyDiviStatus, ApplyDiviStatus.class));
		
		String bankApplyDiviStatus = m.getBankApplyDiviStatus();
		m.setBankApplyDiviStatusDisplay((String)CachedEnums.getValue(bankApplyDiviStatus, HzicbcApplyDiviStatus.class));
	}

}
